package com.ruoyi.machine.advanced.status.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.machine.advanced.status.domain.Status;
import com.ruoyi.machine.advanced.status.domain.StatusCond;
import com.ruoyi.machine.advanced.status.mapper.StatusMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备状态信息
 * 业务层处理
 */
@Service
public class StatusServiceImpl implements IStatusService{

    @Autowired
    private StatusMapper statusMapper;

    /**
     * 查找设备状态信息
     * @param status
     * @return
     */
    @Override
    public List<Status> selectStatusList(StatusCond status) {
        return statusMapper.selectStatusList(status);
    }

    /**
     * 根据Id查找设备状态信息
     * @param machineId
     * @return
     */
    @Override
    public Status selectStatusById(String machineId) {
        return statusMapper.selectStatusById(machineId);
    }

//    @Override
//    public int insertStatus(Status status) {
//        return statusMapper.insertStatus(status);
//    }

    @Override
    public int updateStatus(Status status) {
        if (!StringUtils.isNotNull(statusMapper.selectStatusById(status.getMachineId()))) {
            //存在
            return 0;
        }
//        webSocket.sendMessage(status.getMachineId());
        return statusMapper.updateStatus(status);
    }

   @Override
    public int insertStatusList(Status status){
        return statusMapper.insertStatusList(status);
   };

    @Override
    public int selectStatusListYesterday(){
        return statusMapper.selectStatusListYesterday();
    };
    @Override
    public int selectStatusListYesterday1(){
        return statusMapper.selectStatusListYesterday1();
    };
    @Override
    public int selectStatusListSevenDays(){
        return statusMapper.selectStatusListSevenDays();
    };
    @Override
    public int selectStatusListSevenDays1(){
        return statusMapper.selectStatusListSevenDays1();
    };
    @Override
    public int selectStatusListToday1(){
        return statusMapper.selectStatusListToday1();
    };
    @Override
    public int selectStatusListToday(){
        return statusMapper.selectStatusListToday();
    };
    @Override
    public int selectStatusList30(){
        return statusMapper.selectStatusList30();
    };
    @Override
    public int selectStatusList3(){
        return statusMapper.selectStatusList3();
    };
    @Override
    public int selectStatusList40(){
        return statusMapper.selectStatusList40();
    };
    @Override
    public int selectStatusList4(){
        return statusMapper.selectStatusList4();
    };
    @Override
    public int selectStatusList50(){
        return statusMapper.selectStatusList50();
    };
    @Override
    public int selectStatusList5(){
        return statusMapper.selectStatusList5();
    };
    @Override
    public int selectStatusList60(){
        return statusMapper.selectStatusList60();
    };
    @Override
    public int selectStatusList6(){
        return statusMapper.selectStatusList6();
    };
    @Override
    public int selectStatusList70(){
        return statusMapper.selectStatusList60();
    };
    @Override
    public int selectStatusList7(){
        return statusMapper.selectStatusList6();
    };
    @Override
    public int selectStatusListThirtyDays(){
        return statusMapper.selectStatusListThirtyDays();
    };
    @Override
    public int selectStatusListThirtyDays1(){
        return statusMapper.selectStatusListThirtyDays1();
    };
}
